import {Request, Response} from "express";

export const waitTime = (time: number = 100) => {
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve(true);
    }, time);
  });
};

export default {
  'get /api/language': {
    code: '200',
    success: true,
    resp: [
      {
        code: 'zh-CN',
        name: 'CN 中文',
      },
      {
        code: 'en-US',
        name: 'EN English',
      },
    ],
    msgList: null,
  },

  'get /api/language/resource/zh-CN': {
    code: '200',
    success: true,
    resp: {
      'loginErrorMessage': '账户或密码错误（admin/ant.design)',
      'usernamePlaceholder': '用户名: admin or user',
      'passwordPlaceholder': '密码: ant.design',
      'passwordRequired': '请输入密码！',
      'usernameRequired': '请输入账号！',
      'phoneNumberPlaceholder': '手机号',
      'phoneNumberRequired': '请输入手机号！',
      'phoneNumberInvalid': '手机号格式错误！',
      'captchaPlaceholder': '请输入验证码',
      'getCaptchaSecondText': '获取验证码',
      'getVerificationCode': '获取验证码',
      'captchaRequired': '请输入验证码！',
      'rememberMe': '自动登录',
      'forgotPassword': '忘记密码',
      'loginWith': '其他登录方式',
      'userLayoutTitle': '目标是构建最简单最易上手的管理系统框架',
      'welcome': '欢迎',
      'table': '表格',
      'subPage': '子页面',
      'admin': '管理',
      'loading': '加载中',
      'logout': '退出登录',
      'sayHello': '你好 PZY Open Source Pro',
      'ruleName': '规则名',
      'ruleNameMust': '规则名称为必填项',
      'notPermission': '抱歉，您无权访问该页面.',
      loginTitle: '登录页',
      tabTitleA: '账号密码登录',
      tabTitleB: '手机号登录',
      loginBtnText: '登录',
      accountErrorMsg: '请输入账号!',
      passwordErrorMsg: '请输入密码!',
      registerBtnText: '注册账号',
      rememberMeText: '记住我',
      forgetPwdText: '忘记密码',
      phonePlaceholder: '手机号...',
      validateCodePlaceholder: '验证码...',
      loadValidateCodeBtn: '获取验证码',
      menuWelcome: '欢迎',
      menuOne: '一级菜单',
      menuTwo: '二级菜单',
      menuDemo: '示例',
      userProfile: '个人中心',
      setting: '设置',
      exit: '退出',
      optConfirm: '操作确认',
      logoutConfirm: '您是否确认退出系统?',
      mgrNormal: '弹窗新增管理页',
      mgrNewNormal: '新页新增管理页',
      pageNotFound: '抱歉, 您访问的界面不存在.',
      goBackHome: '返回首页',
      desc403: '抱歉,您没有权限访问这个界面.',
      desc500: '抱歉,服务器好像出问题了.',
      expPage: '异常页',
      page403: '403',
      page500: '500',
      demoPage: '示例界面',
    },
    msgList: null,
  },

  'get /api/language/resource/en-US': {
    code: '200',
    success: true,
    resp: {
      'loginErrorMessage': 'Account Or Password Error（admin/ant.design)',
      'usernamePlaceholder': 'Username: admin or user',
      'passwordPlaceholder': 'Password: ant.design',
      'passwordRequired': 'Please Input Password！',
      'usernameRequired': 'Please Input Account！',
      'phoneNumberPlaceholder': 'Phone Number',
      'phoneNumberRequired': 'Please Input Phone Number！',
      'phoneNumberInvalid': 'Phone Number Error！',
      'captchaPlaceholder': 'Please Input Captcha',
      'getCaptchaSecondText': 'Get Captcha',
      'getVerificationCode': 'Get Captcha',
      'captchaRequired': 'Please Input Captcha！',
      'rememberMe': 'Auto Login',
      'forgotPassword': 'Forget',
      'loginWith': 'Other Login Method',
      'welcome': 'Welcome',
      'table': 'Table',
      'subPage': 'Sub page',
      'admin': 'Admin',
      'loading': 'loading',
      'logout': 'Logout',
      'sayHello': 'Hello PZY Open Source Pro',
      'ruleName': 'Rule Name',
      'ruleNameMust': 'rule name is must',
      'notPermission': 'Sorry, you are not authorized to access this page.',
      loginTitle: 'Login Page',
      tabTitleA: 'Account password login',
      tabTitleB: 'Phone number login',
      accountPlaceholder: 'Account...',
      loginBtnText: 'Login',
      accountErrorMsg: 'Please input account!',
      passwordErrorMsg: 'Please input password!',
      registerBtnText: 'Register',
      rememberMeText: 'Remember me',
      forgetPwdText: 'Forget password',
      phonePlaceholder: 'Phone number...',
      validateCodePlaceholder: 'Validate code...',
      loadValidateCodeBtn: 'Get validate code',
      menuWelcome: 'welcome',
      menuOne: 'first',
      menuTwo: 'second',
      menuDemo: 'demo',
      userProfile: 'Profiles',
      setting: 'Settings',
      exit: 'Exit',
      optConfirm: 'Confirm',
      logoutConfirm: 'Are you sure exit now?',
      mgrNormal: 'Normal Mgr',
      mgrNewNormal: 'New Normal Mgr',
      pageNotFound: 'Sorry, the page you visited does not exist.',
      goBackHome: 'Back Home',
      desc403: "Sorry, you don't have access to this page.",
      desc500: 'Sorry, the server is reporting an error.',
      expPage: 'Exception Page',
      page403: '403',
      page500: '500',
      demoPage: 'Demo Page',
    },
    msgList: null,
  },

  'get /api/menu': async(req: Request, res: Response)=>{
    await waitTime(2000);
    res.send({
      code: '200',
      success: true,
      resp: [
        {
          path: '/welcome',
          name: '欢迎',
          i18n: 'welcome',
          icon: 'iconrenzheng',
        },
        {
          path: '/admin',
          name: '管理',
          i18n: 'admin',
          icon: 'iconrenzheng',
          children: [
            {
              path: '/admin/sub-page',
              name: '子页面',
              i18n: 'subPage',
              icon: 'sub-page',
              children: [],
            },
          ],
        },
        {
          path: '/list',
          name: '表格',
          i18n: 'table',
          icon: 'iconrenzheng',
        }
      ],
      msgList: null,
    })
  },
};
